package common.util;

public class OsUtil {
    private static final String OS = System.getProperty("os.name").toLowerCase();

    public static void main(String[] args) {
        System.out.println("" + OS);
        System.out.println(isMac());
    }

    public static boolean isWindows() {
        return OS.indexOf("win") >= 0;
    }

    public static boolean isWindowsXP() {
        return OS.indexOf("win") >= 0 && OS.indexOf("xp") >= 0;
    }

    public static boolean isMac() {
        return OS.indexOf("mac") >= 0;
    }

    public static boolean isUnix() {
        return OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") >= 0;
    }

    public static boolean isLinux() {
        return OS.indexOf("nux") >= 0;
    }

    public static boolean isSolaris() {
        return (OS.indexOf("sunos") >= 0);
    }

    private static final String ARCH = System.getProperty("sun.arch.data.model");

    public static boolean is64() {
        return "64".equals(ARCH);
    }

    public static boolean is32() {
        return "32".equals(ARCH);
    }
}